<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui">
<ui:composition>
	<div id="mypost">
		<h:form>
			<p:dataTable var="thread" value="#{userBackingBean.myDataModel}" paginator="true" rows="20" lazy="true"
				paginatorTemplate="{CurrentPageReport} {FirstPageLink} {PreviousPageLink}  {PageLinks}  {CurrentPageReport} {NextPageLink} {LastPageLink}"
				rowsPerPageTemplate="5,10,15" tableStyleClass="noBorderTable" paginatorPosition="bottom">
				<p:column headerText="#{msgs.threadSubjectLabel}">
					<h:link value="#{thread.subject}" outcome="/thread/viewthread" styleClass="longstyle">
						<f:param name="id" value="#{thread.id}"></f:param>
					</h:link>
				</p:column>

				<p:column headerText="#{msgs.threadReplyHitLabel}">
					<h:outputText value='#{thread.numberOfReplies}/#{thread.numberOfView}' escape="false"></h:outputText>
				</p:column>
				<p:column headerText="#{msgs.threadAuthorLabel}">
					<h:outputText value='#{thread.owner.userId}' escape="false"></h:outputText>
				</p:column>

				<p:column headerText="#{msgs.threadLastUpdateLabel}">
					<h:panelGroup rendered="#{thread.lastReply!=null}">
						<h:outputText value="#{thread.lastReply.owner.userId}" styleClass="block" />
						<h:outputFormat value="#{thread.lastReply.createTime}">
							<f:convertDateTime dateStyle="short" timeStyle="short" type="both" />
						</h:outputFormat>
					</h:panelGroup>
					<h:panelGroup rendered="#{thread.lastReply==null}">
						<h:outputText value="--/--" />
					</h:panelGroup>
				</p:column>
				<p:column headerText="#{msgs.threadAuthorLabel}" rendered="#{threadBackingBean.ownerForCurrCategory || login.userInSysadmin}">

					<h:commandButton value="Delete" action="#{threadBackingBean.deleteThread(thread)}">
						<p:ajax event="action" update="@form"></p:ajax>
					</h:commandButton>
				</p:column>
			</p:dataTable>
		</h:form>
	</div>

</ui:composition>
</html>